#include "gotocelldialog.h"
#include "ui_dialog.h"

GotoCellDialog::GotoCellDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    QRegExp reqExp("[A-Za-z][1-9][0-9]{0,2}");  //正则表达式
    ui->lineEdit->setValidator(new QRegExpValidator(reqExp,this));
                                       //this作为new QRegExpValidator父对象，自动delete
    connect(ui->okButton,SIGNAL(clicked()),this,SLOT(accept()));
//为什么手动连接信号和槽，exec()返回1，但QT设计师中却返回0
}

GotoCellDialog::~GotoCellDialog()
{
    delete ui;
}
void GotoCellDialog::on_lineEdit_textChanged()
{
    ui->okButton->setEnabled(ui->lineEdit->hasAcceptableInput());
}
QString GotoCellDialog::getCellLocation()
{
    return ui->lineEdit->text();
}
